<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>拼游群二维码维护</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <style>
        #grouptours tr th,td{
            text-align:center
        }
    </style>
</head>

<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <div class="layui-form-item" style="float: left;">
            <form class="layui-form serch" action="/admin/grouptoursline/qrcode" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <input type="text" name="title" lay-verify="title" value="{if isset($wherelist['title'])}{$wherelist['title']}{/if}" autocomplete="off" placeholder="请输入ID/群标题/线路名称/提醒邮箱" class="layui-input layui-btn-sm">
                    </div>
                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                    <a href="{:url('admin/grouptoursline/addqrcode')}" class="layui-btn layui-btn-sm a_menu">
                        新建拼游群二维码
                    </a>
                </div>
            </form>

        </div>
    </fieldset>
    <table class="layui-table" lay-even="" lay-skin="line" id="grouptours">
        <colgroup>
            <col width="5%">
            <col width="10%">
            <col width="10%">
            <col width="10%">
            <col width="10%">
            <col width="10%">
            <col width="10%">
            <col width="10%">
            <col width="10%">
        </colgroup>
        <thead>

        <tr>
            <th >ID</th>
            <th >群标题</th>
            <th >线路名称</th>
            <th >二维码</th>
            <th >过期时间</th>
            <th >提醒邮箱</th>
            <th >创建人</th>
            <th >创建时间</th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td><strong>{$vo.title}</strong></td>
            <td>{$vo.line_name}</td>
            <td>
                <img class="qrcode" src="{$vo.qrcode|geturl}" width="150" alt="">
            </td>
            <td><span {if $vo['is_notice']>0} style="color:red" {/if}>{$vo.expire_time}</span></td>
            <td>{$vo.notice_email}</td>
            <td>{$vo.admin_name}</td>
            <td>{$vo.create_time}</td>
            <td class="operation-menu">
                <a href="{:url('admin/grouptoursline/addqrcode',['id'=>$vo.id])}" class="layui-btn layui-btn-xs layui-btn-info a_menu"  style="margin-right: 0;margin-top:2px;font-size:12px;margin-bottom:4px">编辑</a>
                <!--<a class="layui-btn layui-btn-xs layui-btn-danger delete" codeid="{$vo.id}" style="margin-right: 0;margin-top:2px;font-size:12px;margin-bottom:4px">删除</a>-->
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$list->render()}</div>

    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>


    <script type="text/javascript">

        $('.delete').click(function(){
            var id = $(this).attr('codeid');
            layer.confirm('确定要删除?', function(index) {
                $.ajax({
                    url:"{:url('admin/grouptoursline/delqrcode')}",
                    data:{id:id},
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })
    </script>
    <script type="text/javascript">
        layui.use(['layer','form'],function(){
            var layer = layui.layer;
            var form = layui.form;
            $('.a_menu').click(function(){
                var url = $(this).attr('href');
                var a = 0;
                $.ajax({
                    url:url
                    ,async:false
                    ,success:function(res){
                        if(res.code == 0) {
                            layer.msg(res.msg);
                            a = 1;
                        }
                    }
                })
                if(a === 0) {
                    layer.open({
                        type:2,
                        content:url,
                        area: ['60%', '90%'],
                        end:function(){
                            location.reload();
                        }
                    });
                }
                return false;
            })
        });
    </script>
    <script>
        $(".qrcode").click(function(){
            var that = this;
            amplificationImg(that);
        })

        function amplificationImg(that) {
            var url = $(that).attr("src");
            layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                shadeClose: true,
                area: ['400px', '600px'], //宽高
                content: "<img width='400' src=" + url + " />"
            });
        }
    </script>
</div>
</body>
</html>
